#pragma once

class AbstractDisplay
{
// make pure virtual functions private gives better encapsulation.
private:
    // must be pure virtual functions, otherwise compiler can't generate vtable properly without function
    // definitions. But those definitions are optional for pure virutal functions
    virtual void open() = 0;
    virtual void end() = 0;
    virtual void print() = 0;
public:
    // father class defines abstract algorithm
    void display()
    {
        open();
        for(int i = 0; i < 5; i++)
            print();
        end();
    }
};